Imports System.Windows.Forms

Public Class frmNativo

    Dim mArbol As frmArbolFormularios

    Protected Overrides Function Autorizado() As Boolean
        Return True
    End Function

    Private Sub ExitToolsStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ExitToolStripMenuItem.Click
        Global.System.Windows.Forms.Application.Exit()
    End Sub

    Private Sub CutToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CutToolStripMenuItem.Click
        ' Utilice My.Computer.Clipboard para insertar el texto o las imágenes seleccionadas en el Portapapeles
    End Sub

    Private Sub CopyToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CopyToolStripMenuItem.Click
        ' Utilice My.Computer.Clipboard para insertar el texto o las imágenes seleccionadas en el Portapapeles
    End Sub

    Private Sub PasteToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles PasteToolStripMenuItem.Click
        'Utilice My.Computer.Clipboard.GetText() o My.Computer.Clipboard.GetData para recuperar la información del Portapapeles.
    End Sub

    Private Sub CascadeToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CascadeToolStripMenuItem.Click
        Me.LayoutMdi(MdiLayout.Cascade)
    End Sub

    Private Sub TileVerticleToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles TileVerticalToolStripMenuItem.Click
        Me.LayoutMdi(MdiLayout.TileVertical)
    End Sub

    Private Sub TileHorizontalToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles TileHorizontalToolStripMenuItem.Click
        Me.LayoutMdi(MdiLayout.TileHorizontal)
    End Sub

    Private Sub ArrangeIconsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ArrangeIconsToolStripMenuItem.Click
        Me.LayoutMdi(MdiLayout.ArrangeIcons)
    End Sub

    Private Sub frmNativo_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated

    End Sub

    Private Sub frmNativo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Size = My.Settings.frmNativoSize
        Me.WindowState = My.Settings.frmNativoWindowState

        mnuVerArbolFormularios.Checked = True
    End Sub

    Private Sub frmNativo_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        If Me.WindowState = FormWindowState.Normal Then
            My.Settings.frmNativoSize = Me.Size
        Else
            My.Settings.frmNativoSize = Me.RestoreBounds.Size
        End If
        My.Settings.frmNativoWindowState = Me.WindowState
    End Sub

    Private Sub mnuVerArbolFormularios_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuVerArbolFormularios.CheckedChanged
        If mnuVerArbolFormularios.Checked Then
            AbrirArbol()
        Else
            If mArbol IsNot Nothing Then
                CerrarArbol()
            End If
        End If
    End Sub

    Private Sub mArbol_FormClosed(ByVal sender As Object, ByVal e As FormClosedEventArgs)
        RemoveHandler mArbol.FormClosed, AddressOf Me.mArbol_FormClosed
        mArbol = Nothing
        mnuVerArbolFormularios.Checked = False
    End Sub

    Private Sub AbrirArbol()
        mArbol = New frmArbolFormularios
        mArbol.MdiParent = Me
        mArbol.Show()
        AddHandler mArbol.FormClosed, AddressOf Me.mArbol_FormClosed
    End Sub

    Private Sub CerrarArbol()
        mArbol.Close()
    End Sub

End Class
